package com.xudm.cdg.entity.system;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 操作日志
 * </p>
 *
 * @author xudm
 * @since 2024-06-20
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("t_cdg_operation_log")
public class OperationLog extends Model<OperationLog> {

    /**
     * 主键
     */
    @TableId(value = "f_id", type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 访问模块
     */
    @TableField("f_visit_module")
    private String visitModule;

    /**
     * 请求地址
     */
    @TableField("f_request_url")
    private String requestUrl;

    /**
     * 请求方式
     */
    @TableField("f_request_type")
    private String requestType;

    /**
     * 服务器IP
     */
    @TableField("f_server_ip")
    private String serverIp;

    /**
     * 客户端IP
     */
    @TableField("f_client_ip")
    private String clientIp;

    /**
     * 请求头信息
     */
    @TableField("f_request_header")
    private String requestHeader;

    /**
     * 入参
     */
    @TableField("f_input_params")
    private String inputParams;

    /**
     * 出参
     */
    @TableField("f_output_params")
    private String outputParams;

    /**
     * 耗时 ms
     */
    @TableField("f_cost_time")
    private Long costTime;

    /**
     * 创建人
     */
    @TableField(value = "f_created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(value = "f_created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    public static final String F_ID = "f_id";

    public static final String F_VISIT_MODULE = "f_visit_module";

    public static final String F_REQUEST_URL = "f_request_url";

    public static final String F_REQUEST_TYPE = "f_request_type";

    public static final String F_SERVER_IP = "f_server_ip";

    public static final String F_CLIENT_IP = "f_client_ip";

    public static final String F_REQUEST_HEADER = "f_request_header";

    public static final String F_INPUT_PARAMS = "f_input_params";

    public static final String F_OUTPUT_PARAMS = "f_output_params";

    public static final String F_COST_TIME = "f_cost_time";

    public static final String F_REVISION = "f_revision";

    public static final String F_CREATED_BY = "f_created_by";

    public static final String F_CREATED_TIME = "f_created_time";

    @Override
    public Serializable pkVal() {
        return this.id;
    }
}
